#pragma once
#include <ntifs.h>
#include "vtasm.h"
#include "vtsystem.h"

ULONG BackEip;
ULONG BackEsp;

//提供一个Unload函数知识为了让这个程序能动态卸载，方便调试
VOID DriverUnload(PDRIVER_OBJECT driver)
{
    StopVirtualTechnology();
    DbgPrint("first:		Our driver is unloading ... \r\n");
}
//DriverEntry,入口函数，相当于main
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
{

    DbgPrint("first:		Hello,Driver!...\r\n");
    //设置一个卸载函数，便于这个函数退出
    driver->DriverUnload = DriverUnload;

    __asm{
        pushad
        pushfd
        mov BackEip,offset DriverEntryFlow
        mov BackEsp,esp
    }
    StartVirtualTechnology();
    __asm{
    DriverEntryFlow:
        popfd
        popad
    }


    LogLn("Driver Load Complete!");
    return STATUS_SUCCESS;
}
